package com.pengshun.modules.api.mapper;


import com.pengshun.modules.api.coal.service.dto.MerchantCoalDto;
import com.pengshun.modules.domain.MerchantCoal;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface MerchantCoalMapper {

    /**
     * 查询商户煤商品列表
     * @param userId
     * @param page
     * @param size
     * @param status
     * @return
     */
    List<MerchantCoalDto> selectCoalList(@Param("userId") Long userId, @Param("page") Integer page, @Param("size") Integer size, @Param("status") Integer status);

    @Select("select  * from ps_merchant_coal pc  WHERE  pc.`merchant_id`=#{merchantId} and  pc.issue_status=2 and pc.`coal_number`>0  and pc.`is_show`=1  " +
            " AND pc.`status`=1 and pc.over_time>now() order by pc.issue_time desc")
    List<MerchantCoal> findByMerchantId(@Param("merchantId") Long merchantId);
}
